package Exams.MeituanPack.q2021.q13_loveLetter;
import java.util.Arrays;
import java.util.Scanner;
public class Solution {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        // 获取字符串的长度
        int n = scanner.nextInt();
        // 获得字符串
        char[] str = scanner.next().toCharArray();
        System.out.println(Arrays.toString(str));

        int res = 0, ans = 0;
        for (int i = 0; i < n; i++) {
            res += str[i] == 'E' ? 1 : -1;
            if(res < 0){
                res = 0;
            }
            ans = Math.max(res, ans);
        }

        System.out.println(ans);
    }
}
